/*  THIS .DO FILE DOES THE FOLLOWING:  1. Section 1 imports the raw data, cleans data, and creates new variables for analysis. 	It then save a file for analysis where the unit of observation is the respondent  2. Section 2 reshapes the data so that each observation is a single conjoint profile within a	profile pair, and saves the resulting dataset.	 3. Section 3 produces the tables and figures presented in the main paper  4. Section 4 produces the tables and figures presented in Online Appendix A  5. Section 5 produces the tables and figures presented in Online Appendix C  */clear allset more offset scheme s1mono* PLEASE SET YOUR FILEPATH HERE: 	cd "[PUT FILEPATH HERE]"		**************************************************************************************************		SECTION 1: DATA CLEANING AND VARAIBLE CREATION		************************************************************************************// Import raw data file	use "Conjoint_experiment_raw.dta"	// Fix mixlabed observations (i.e. on day X enumerator recorded doing survey 2 twice): 	* Had 5 pairs: were able to use paper records to fix 3, are dropping other 2		* 3 mislabeled surveys: wrong day. Decided which were correct based on town selected.			replace dayenumeration=7 if dayenumeration==6 & town=="Kyotera"			replace dayenumeration=3 if dayenumeration==5 & town=="Seeta"			replace dayenumeration=4 if dayenumeration==3 & town=="Jinja town"				* Drop 2 observations where paper records don't help determine correct survey date / enumerator			drop if enumerator==1 & dayenumeration==8 & interviewnumber==8 & age==45			drop if enumerator==1 & dayenumeration ==10 & interviewnumber==7 & age==37// Fix District & Location Variables		* West Team wrote Masaka instead of Rakai on day 7 because option wasn't on drop-down		replace area="Rakai" if area=="Masaka" & dayenum==7	* Fix enumerator errors in entering District - corrected using paper records		replace area="Iganga" if area=="Jinja" & dayenum==8		replace area="Lwengo" if area=="Masaka" & dayenum==9			* Fix enumerator errors in selecting town of enumeration (done using paper records)		* Create dummy for each enumeration team		gen team=.			replace team=1	if enumerator==5 | enumerator==4 | enumerator==1 | enumerator==3 | enumerator==10			replace team=2	if enumerator==8 | enumerator==2 | enumerator==9 | enumerator==7 | enumerator==6				* Label raw town variables		label var town "Town according to Enum entry: uncorrected"				* Create corrected town variable		gen town_2=""			label var town_2 "Correct town according to Paper records"						replace town_2="Kalagi" if dayenum==3 & team==1			replace town_2="Jinja Town" if dayenum==4 & team==1			replace town_2="Bugembe" if dayenum==5 & team==1			replace town_2="Mafubira" if dayenum==6 & team==1			replace town_2="Masese" if dayenum==7 & team==1			replace town_2="Iganga Town" if dayenum==8 & team==1			replace town_2="Nakalama" if dayenum==9 & team==1			replace town_2="Njeru" if dayenum==10 & team==1			replace town_2="Wakitaka" if dayenum==11 & team==1						replace town_2="Seeta" if dayenum==3 & team==2			replace town_2="Masaka Town" if dayenum==4 & team==2			replace town_2="Lukaya Town" if dayenum==5 & team==2			replace town_2="Nyendo" if dayenum==6 & team==2			replace town_2="Kyotera" if dayenum==7 & team==2			replace town_2="Saza" if dayenum==8 & team==2			replace town_2="Kinoni" if dayenum==9 & team==2			replace town_2="Kalisizo" if dayenum==10 & team==2			replace town_2="Kabaale Bugonzi" if dayenum==11 & team==2							* Fix incorrect area names using paper records		replace area="Buikwe" if town_2=="Njeru"		replace area="Rakai" if town_2=="Kalisizo"																		// Create additional variables used in heterogeneity analysis		* Days a week worked: combine data from each occupational group			gen days_week=.				replace days_week=medays_wk if market==1				replace days_week=bddays_week if boda==1				replace days_week=sedays_week if shop==1				label var days_week "Reported days a week at work"		* Weekly income			gen weekly_profit=days_week*daily_income			label var weekly_profit "Estimated weekly profits"			* Education: create dummies for highest education level = post-secondary 			gen postsec_ed=cond(years_ed>=14,1,0) if years_ed!=.					* Clarify label on voting question 			label var presvote "1 if voted in last presidential election"// Construct unique PID: this is done by concatenating the day of enumeration; the enumerator ID number;	* and what number interview the respondent was for that enumerator-day	* Ex: enumerator 10, enumeration day 1, 6th survey of day --> pid=100106			tostring dayenum, gen(daystr)		tostring interviewnumber, gen(idstr)		tostring enumerator, gen(enumstr)			foreach x of numlist 1/9 {			qui replace daystr="0`x'" if daystr=="`x'"			qui replace idstr="0`x'" if idstr=="`x'"			qui replace enumstr="0`x'" if enumstr=="`x'"			}				egen pid=concat(enumstr daystr idstr)		destring pid, replace		move pid enumerator		// Create enumerator & Town Fixed Effects		* Create enumerator dummy variables:			tab enumerator, gen(e_)		* Create town-level dummy variables			tab town_2, gen(townfe_)				// Create variables needed to compare average conjoint ranking to hypothetical willingness to act (Appendix C4)	* Clean goprotest variable		replace goprotest=. if goprotest==-99	* Generate average ranking in conjoint experiment across all 8 profiles		egen avg_rank=rowmean(rank1_* rank2_*)		label var avg_rank "Average severity ranking in conjoint"	* Generate average likelihood of taking action in post-treatment vignette (for Table 9)	egen avg_action=rowmean(goprotest contact_official campaign_against talkneighb)		label var avg_action "Average likelihood of political action in response to scandal"			// Save data file where unit of observation is each respondent	save "respondent_level_clean.dta", replace		**********************************************************************************************************************************************************************************************	SECTION 2: PREPARE AND RESHAPE DATA FOR CONJOINT ANALYSIS		**************************************************************************************************************************************************************************************// PART 1: CREATE DUMMIES FOR TREATMENT ASSIGNMENT FOR EACH ATTRIBUTE IN EACH PROFILE 	// AND GENERATE OUTCOME VARIABLES FOR EACH PROFILE WITHIN EACH PAIR	* a and b refer to whether a profile appeared first or second. 1-4 indicate profile pair number.	* So, "_a1" indicates a variable reports the treatment assignment for the first profile in pair 1// ATTRIBUTE 1: ELECTED VS. APPOINTED OFFICIALS		gen ATTRIBUTE_1=.	label var ATTRIBUTE_1 "-----------------------"		gen elect_a1=cond(rdn>.5,1,0) 	gen elect_b1=cond(rdn2>.5,1,0) 	gen elect_a2=cond(rdn3>.5,1,0) 	gen elect_b2=cond(rdn4>.5,1,0) 	gen elect_a3=cond(rdn5>.5,1,0) 	gen elect_b3=cond(rdn6>.5,1,0) 	gen elect_a4=cond(rdn7>.5,1,0) 	gen elect_b4=cond(rdn8>.5,1,0) 			gen appt_a1=cond(rdn<=.5,1,0)	gen appt_b1=cond(rdn2<=.5,1,0)	gen appt_a2=cond(rdn3<=.5,1,0)	gen appt_b2=cond(rdn4<=.5,1,0)	gen appt_a3=cond(rdn5<=.5,1,0)	gen appt_b3=cond(rdn6<=.5,1,0)	gen appt_a4=cond(rdn7<=.5,1,0)	gen appt_b4=cond(rdn8<=.5,1,0)	// ATTRIBUTE 2: CENTRAL VS. LOCAL GOVERNMENT	gen ATTRIBUTE_2=.	label var ATTRIBUTE_2 "-----------------------"				gen central_a1=cond(rd2n>.5,1,0)	gen central_b1=cond(rd2n2>.5,1,0)	gen central_a2=cond(rd2n3>.5,1,0)	gen central_b2=cond(rd2n4>.5,1,0)	gen central_a3=cond(rd2n5>.5,1,0)		gen central_b3=cond(rd2n6>.5,1,0)	gen central_a4=cond(rd2n7>.5,1,0)	gen central_b4=cond(rd2n8>.5,1,0)	gen local_a1=cond(rd2n<=.5,1,0)	gen local_b1=cond(rd2n2<=.5,1,0)	gen local_a2=cond(rd2n3<=.5,1,0)	gen local_b2=cond(rd2n4<=.5,1,0)			gen local_a3=cond(rd2n5<=.5,1,0)	gen local_b3=cond(rd2n6<=.5,1,0)	gen local_a4=cond(rd2n7<=.5,1,0)	gen local_b4=cond(rd2n8<=.5,1,0)// ATTRIBUTE 3: DONOR, TAX, OR TRANSFER FUNDS		gen ATTRIBUTE_3=.	label var ATTRIBUTE_3 "-----------------------"		gen donor_a1=cond(rd3n<(1/3),1,0)	gen donor_b1=cond(rd3n2<(1/3),1,0)	gen donor_a2=cond(rd3n3<(1/3),1,0)		gen donor_b2=cond(rd3n4<(1/3),1,0)	gen donor_a3=cond(rd3n5<(1/3),1,0)	gen donor_b3=cond(rd3n6<(1/3),1,0)	gen donor_a4=cond(rd3n7<(1/3),1,0)		gen donor_b4=cond(rd3n8<(1/3),1,0)			gen tax_a1=cond(rd3n>=(1/3) & rd3n<(2/3),1,0)	gen tax_b1=cond(rd3n2>=(1/3) & rd3n2<(2/3),1,0)	gen tax_a2=cond(rd3n3>=(1/3) & rd3n3<(2/3),1,0)	gen tax_b2=cond(rd3n4>=(1/3) & rd3n4<(2/3),1,0)	gen tax_a3=cond(rd3n5>=(1/3) & rd3n5<(2/3),1,0)	gen tax_b3=cond(rd3n6>=(1/3) & rd3n6<(2/3),1,0)	gen tax_a4=cond(rd3n7>=(1/3) & rd3n7<(2/3),1,0)	gen tax_b4=cond(rd3n8>=(1/3) & rd3n8<(2/3),1,0)		gen transfer_a1=cond(rd3n>(2/3),1,0)	gen transfer_b1=cond(rd3n2>(2/3),1,0)	gen transfer_a2=cond(rd3n3>(2/3),1,0)	gen transfer_b2=cond(rd3n4>(2/3),1,0)	gen transfer_a3=cond(rd3n5>(2/3),1,0)	gen transfer_b3=cond(rd3n6>(2/3),1,0)	gen transfer_a4=cond(rd3n7>(2/3),1,0)	gen transfer_b4=cond(rd3n8>(2/3),1,0)// ATTRIBUTE 4: GAVE MONEY TO SELF, KIN/VILLAGE, OR ELECTION SUPPORT	gen ATTRIBUTE_4=.	label var ATTRIBUTE_4 "-----------------------"		gen self_a1=cond(rd4n<(1/3),1,0)	gen self_b1=cond(rd4n2<(1/3),1,0)	gen self_a2=cond(rd4n3<(1/3),1,0)		gen self_b2=cond(rd4n4<(1/3),1,0)	gen self_a3=cond(rd4n5<(1/3),1,0)	gen self_b3=cond(rd4n6<(1/3),1,0)		gen self_a4=cond(rd4n7<(1/3),1,0)	gen self_b4=cond(rd4n8<(1/3),1,0)	gen kinvill_a1=cond(rd4n>=(1/3) & rd4n<(2/3),1,0)	gen kinvill_b1=cond(rd4n2>=(1/3) & rd4n2<(2/3),1,0)	gen kinvill_a2=cond(rd4n3>=(1/3) & rd4n3<(2/3),1,0)	gen kinvill_b2=cond(rd4n4>=(1/3) & rd4n4<(2/3),1,0)	gen kinvill_a3=cond(rd4n5>=(1/3) & rd4n5<(2/3),1,0)	gen kinvill_b3=cond(rd4n6>=(1/3) & rd4n6<(2/3),1,0)	gen kinvill_a4=cond(rd4n7>=(1/3) & rd4n7<(2/3),1,0)	gen kinvill_b4=cond(rd4n8>=(1/3) & rd4n8<(2/3),1,0)			gen buyel_a1=cond(rd4n>(2/3),1,0)	gen buyel_b1=cond(rd4n2>(2/3),1,0)	gen buyel_a2=cond(rd4n3>(2/3),1,0)		gen buyel_b2=cond(rd4n4>(2/3),1,0)	gen buyel_a3=cond(rd4n5>(2/3),1,0)	gen buyel_b3=cond(rd4n6>(2/3),1,0)		gen buyel_a4=cond(rd4n7>(2/3),1,0)	gen buyel_b4=cond(rd4n8>(2/3),1,0)	// ATTRIBUTE 5: STOLE FROM GOVERNMENT SALARIES, WATER, EDUCATION, INFRASTRUCTURE, OR HEALTH	gen ATTRIBUTE_5=.	label var ATTRIBUTE_5 "-----------------------"		gen sal_a1=cond(rd5n<.2,1,0)	gen sal_b1=cond(rd5n2<.2,1,0)	gen sal_a2=cond(rd5n3<.2,1,0)	gen sal_b2=cond(rd5n4<.2,1,0)	gen sal_a3=cond(rd5n5<.2,1,0)	gen sal_b3=cond(rd5n6<.2,1,0)			gen sal_a4=cond(rd5n7<.2,1,0)	gen sal_b4=cond(rd5n8<.2,1,0)	gen water_a1=cond(rd5n>=.2 & rd5n<.4,1,0)	gen water_b1=cond(rd5n2>=.2 & rd5n2<.4,1,0)	gen water_a2=cond(rd5n3>=.2 & rd5n3<.4,1,0)	gen water_b2=cond(rd5n4>=.2 & rd5n4<.4,1,0)	gen water_a3=cond(rd5n5>=.2 & rd5n5<.4,1,0)	gen water_b3=cond(rd5n6>=.2 & rd5n6<.4,1,0)			gen water_a4=cond(rd5n7>=.2 & rd5n7<.4,1,0)	gen water_b4=cond(rd5n8>=.2 & rd5n8<.4,1,0)	gen educ_a1=cond(rd5n>=.4 & rd5n<.6,1,0)	gen educ_b1=cond(rd5n2>=.4 & rd5n2<.6,1,0)	gen educ_a2=cond(rd5n3>=.4 & rd5n3<.6,1,0)	gen educ_b2=cond(rd5n4>=.4 & rd5n4<.6,1,0)	gen educ_a3=cond(rd5n5>=.4 & rd5n5<.6,1,0)	gen educ_b3=cond(rd5n6>=.4 & rd5n6<.6,1,0)	gen educ_a4=cond(rd5n7>=.4 & rd5n7<.6,1,0)	gen educ_b4=cond(rd5n8>=.4 & rd5n8<.6,1,0)	gen infra_a1=cond(rd5n>=.6 & rd5n<.8,1,0)	gen infra_b1=cond(rd5n2>=.6 & rd5n2<.8,1,0)	 	gen infra_a2=cond(rd5n3>=.6 & rd5n3<.8,1,0)	gen infra_b2=cond(rd5n4>=.6 & rd5n4<.8,1,0)	gen infra_a3=cond(rd5n5>=.6 & rd5n5<.8,1,0)	gen infra_b3=cond(rd5n6>=.6 & rd5n6<.8,1,0)	gen infra_a4=cond(rd5n7>=.6 & rd5n7<.8,1,0)	gen infra_b4=cond(rd5n8>=.6 & rd5n8<.8,1,0)	gen health_a1=cond(rd5n>=.8,1,0)	gen health_b1=cond(rd5n2>=.8,1,0)		gen health_a2=cond(rd5n3>=.8,1,0)	gen health_b2=cond(rd5n4>=.8,1,0)		gen health_a3=cond(rd5n5>=.8,1,0)	gen health_b3=cond(rd5n6>=.8,1,0)		gen health_a4=cond(rd5n7>=.8,1,0)	gen health_b4=cond(rd5n8>=.8,1,0)	// GENERATE VARIABLES REPRESENTING OUTCOMES IN EACH PROFILE IN EACH PAIR// Generate  choice variables	gen choice_a1=cond(choice_1==1,1,0)	gen choice_b1=cond(choice_1==2,1,0)		gen choice_a2=cond(choice_2==1,1,0)	gen choice_b2=cond(choice_2==2,1,0)		gen choice_a3=cond(choice_3==1,1,0)	gen choice_b3=cond(choice_3==2,1,0)		gen choice_a4=cond(choice_4==1,1,0)	gen choice_b4=cond(choice_4==2,1,0)		gen rank_a1=rank1_1	gen rank_a2=rank1_2	gen rank_a3=rank1_3	gen rank_a4=rank1_4		gen rank_b1=rank2_1	gen rank_b2=rank2_2	gen rank_b3=rank2_3	gen rank_b4=rank2_4	********			RESHAPE DATA FOR CONJOINT ANALYSIS					********	* Reshape data so that each observation is a single profile pair (4 observations per respondent) reshape long choice_a elect_a appt_a central_a local_a donor_a tax_a transfer_a  self_a kinvill_a buyel_a sal_a water_a educ_a infra_a health_a ///choice_b elect_b appt_b central_b local_b donor_b tax_b transfer_b  self_b kinvill_b buyel_b sal_b water_b educ_b infra_b health_b rank_a rank_b, i(pid) j(profile)	// Make new unique ID for each respondent-profile-pair (profile-pid)			tostring pid, gen(pidstr)			tostring profile, gen(profstr)			gen pid_prof=pidstr+profstr			destring pid_prof, replace	// Rename suffixes for next reshape		rename choice_a chosen1		rename choice_b chosen2		local stems "elect appt central local donor tax transfer self kinvill buyel sal water educ infra health rank"		foreach x of local stems {			rename `x'_a `x'1			rename `x'_b `x'2			}	// Reshape dataset so that each observation is a single profile (8 observations per respondent) 		reshape long chosen elect appt central local donor tax transfer self kinvill buyel sal water educ infra health rank, i(pid_prof) j(profileab)			//  Label variables for analysis		label var elect "Elected"		label var appt "Appointed"		label var central "Central"		label var local "Local"		label var donor "Foreign aid"		label var tax "Taxes"		label var transfer "Central Transfers"		label var self "On Himself"		label var kinvill "Patronage"		label var buyel "Clientelism"		label var sal "Government Salaries"		label var water "Water"		label var educ "Education"		label var infra "Infrastructure"		label var health "Health Care"					// For analysis, make categorical variables for each conjoint attribute		gen att1_s=""			replace att1_s="Elected" if elect==1			replace att1_s="Appointed" if appt==1		gen att2_s=""			replace att2_s="Central" if central==1			replace att2_s="Local" if local==1					gen att2=.			replace att2=1 if local==1			replace att2=2 if central==1			label define att2 1 "Local" 2 "Central"			label values att2 att2		gen att3_s=""			replace att3_s="Foreign Aid" if donor==1			replace att3_s="Tax" if tax==1			replace att3_s="Transfers" if transfer==1				gen att4=.			replace att4=3  if kinvill==1			replace att4=2  if buyel==1			replace att4=1  if self==1			label define att4 1 "Himself" 2 "Clientelism" 3 "Patronage"			label values att4 att4					gen att5=.			replace att5=1 if sal   ==1			replace att5=2 if water ==1			replace att5=3 if infra ==1			replace att5=4 if educ  ==1			replace att5=5 if health==1			label define att5 1 "Salaries" 2 "Water" 3 "Infrastructure/Roads" 4 "Education" 5 "Health Care"			label values att5 att5					foreach x of numlist 1 3 {			encode att`x'_s, gen(att`x')			drop att`x'_s			}			// Create interactions for fully saturated model		foreach x of varlist local tax transfer kinvill buyel water health educ infra {			gen elect_`x'=elect*`x'			}		foreach x of varlist tax transfer kinvill buyel water health educ infra {			gen local_`x'=local*`x'			}		foreach x of varlist kinvill buyel water health educ infra {			gen tax_`x'=tax*`x'			gen transfer_`x'=transfer*`x'			}		foreach x of varlist water health educ infra {			gen kinvill_`x'=kinvill*`x'			gen buyel_`x'=buyel*`x'			}				global interacts "elect_* local_* tax_* transfer_* kinvill_* buyel_*"	// Save data file where unit of observation is each profile (8 obs per respondent)		save "profile_level_clean.dta", replace				********************************************************************************************************************************************************************** SECTION 3: ANALYSIS FOR MAIN PAPER					   	**************************************************************************************************************************************************************// Open profile-level dataset	use "profile_level_clean.dta", clear// Set globals for analysis: enumerator fixed effects and town fixed effects		gl fe "e_* "		gl townfe "townfe_*"	// FIGURE 1: Main conjoint analysis	// LEFT HAND SIDE: Change in Pr(official selected)	reg chosen i.att1 i.att2 i.att3 i.att5 i.att4 $fe $townfe, cluster(pid)		estimate store chosen_res	coefplot chosen_res, mcolor(black) ciopts(lcolor(black) lwidth(thin)) xlabel(-.1(.1).3) drop(_cons e_* $townfe) omitted base xline(0) headings(1.att1 = "{bf:Type of Official}" 1.att2 = "{bf:Level of Government}" 1.att3 = "{bf:Source of Funds}" 1.att4 = "{bf:How Funds Spent}" 1.att5 = "{bf:Funds Stolen From}" )  ///		ylabel(, labsize(medlarge)) xtitle("Change in Pr(Official Punished)") ytitle("") xsize(5) ysize(7) scale(.6)	graph export "Tables/chosen.pdf", as(pdf) replace	// RIGHT-HAND SIDE: Change in 5-point severity ranking. 		reg rank i.att1 i.att2 i.att3 i.att5 i.att4 $fe $townfe, cluster(pid)		estimate store rank_res	coefplot rank_res, mcolor(black) ciopts(lcolor(black) lwidth(thin)) xlabel(-.1(.1).5) drop(_cons e_* $townfe) omitted base xline(0) headings(1.att1 = "{bf:Type of Official}" 1.att2 = "{bf:Level of Government}" 1.att3 = "{bf:Source of Funds}" 1.att4 = "{bf:How Funds Spent}" 1.att5 = "{bf:Funds Stolen From}" )  ///		ylabel(, labsize(medlarge)) xtitle("Change in 5-pt Severity Ranking") ytitle("") xsize(5) ysize(7) scale(.6)	graph export "Tables/rank.pdf", as(pdf) replace**********************************************************************************************************************************************************************	SECTION 4: ANALYSIS FOR ONLINE APPENDIX APPENDIX A	**************************************************************************************************************************************************************		// Open data file where unit of observation is each respondent	use "respondent_level_clean.dta", clear	// TABLE 2: Average values of covariates, by occupational group. 	eststo summstats: estpost summarize male age education_years daily_income reg_dum presvote 	eststo boda: estpost summarize male age education_years daily_income reg_dum presvote  if boda==1	eststo shop: estpost summarize male age education_years daily_income reg_dum presvote  if shopkeeper==1	eststo market: estpost summarize male age education_years daily_income reg_dum presvote  if market==1		esttab boda shop market using "Tables/sumstats.tex",  replace main(mean %6.2f) aux(sd %6.2f) mtitle("Boda" "Shopkeeper" "Market") 						********************************************************************************************************************************************************************** SECTION 5: ANALYSIS FOR ONLINE APPENDIX C (Additional Results: Conjoint Experiment)**************************************************************************************************************************************************************	********	OPEN DATASET AND SET GLOBALS FOR APPENDICES C1-C3			* Open profile-level dataset		use "profile_level_clean.dta", clear	* Set globals for analysis: enumerator fixed effects and town fixed effects		gl fe "e_* "		gl townfe "townfe_*"		********	APPENDIX C1: MAIN REGRESSION ANALYSIS			// TABLE 3: OLS results of the Conjoint Analysis. This matches the estimates shown in Figure 1	reg chosen elect local tax transfer  water health educ infra kinvill buyel $fe $townfe, cluster(pid)		outreg2 using "Tables/main_results", replace tex(frag) bdec(3) drop(e_* $townfe) ctitle(Chosen)	label		reg rank elect local tax transfer water health educ infra kinvill buyel $fe $townfe, cluster(pid)		outreg2 using "Tables/main_results", append tex(frag) bdec(3) drop(e_* $townfe) ctitle(Rank)	label	********	APPENDIX C3: ROBUSTNESS CHECKS		// TABLE 4: OLS results for forced-choice analysis, by profile pair 	reg chosen elect local tax transfer kinvill buyel water health educ infra $fe $townfe if profile==1, cluster(pid)		outreg2 using "Tables/rob_prof", replace tex(frag) bdec(3) drop(e_* $townfe) ctitle(Prof Pair 1)	label		reg chosen elect local tax transfer kinvill buyel water health educ infra $fe $townfe if profile==2, cluster(pid)		outreg2 using "Tables/rob_prof", append tex(frag) bdec(3) drop(e_* $townfe) ctitle(Prof Pair 2)	label		reg chosen elect local tax transfer kinvill buyel water health educ infra $fe $townfe if profile==3, cluster(pid)		outreg2 using "Tables/rob_prof", append tex(frag) bdec(3) drop(e_* $townfe) ctitle(Prof Pair 3)	label		reg chosen elect local tax transfer kinvill buyel water health educ infra $fe $townfe if profile==4, cluster(pid)		outreg2 using "Tables/rob_prof", append tex(frag) bdec(3) drop(e_* $townfe) ctitle(Prof Pair 4)	label					// TABLE 5: OLS results for 5-point severity ranking analysis, by profile pair 	reg rank elect local tax transfer kinvill buyel water health educ infra $fe $townfe if profile==1, cluster(pid)		outreg2 using "Tables/rob_prof_rk", replace tex(frag) bdec(3) drop(e_* $townfe) ctitle(Prof Pair 1)	label		reg rank elect local tax transfer kinvill buyel water health educ infra $fe $townfe if profile==2, cluster(pid)		outreg2 using "Tables/rob_prof_rk", append tex(frag) bdec(3) drop(e_* $townfe) ctitle(Prof Pair 2)	label		reg rank elect local tax transfer kinvill buyel water health educ infra $fe $townfe if profile==3, cluster(pid)		outreg2 using "Tables/rob_prof_rk", append tex(frag) bdec(3) drop(e_* $townfe) ctitle(Prof Pair 3)	label		reg rank elect local tax transfer kinvill buyel water health educ infra $fe $townfe if profile==4, cluster(pid)		outreg2 using "Tables/rob_prof_rk", append tex(frag) bdec(3) drop(e_* $townfe) ctitle(Prof Pair 4)	label					// TABLE 6: OLS results for Chosen and Rank broken down by within-profile-pair order 	reg chosen elect local tax transfer kinvill buyel water health educ infra $fe  $townfe if profileab==1, cluster(pid)			outreg2 using "Tables/rob_ab", replace tex(frag) bdec(3) drop(e_* $townfe) ctitle(Prof A Chosen)	label		reg chosen elect local tax transfer kinvill buyel water health educ infra $fe $townfe if profileab==2, cluster(pid)			outreg2 using "Tables/rob_ab", append tex(frag) bdec(3) drop(e_* $townfe) ctitle(Prof B Chosen)	label		reg rank elect local tax transfer kinvill buyel water health educ infra $fe $townfe if profileab==1, cluster(pid)			outreg2 using "Tables/rob_ab", append tex(frag) bdec(3) drop(e_*  $townfe) ctitle(Prof A Rank)	label		reg rank elect local tax transfer kinvill buyel water health educ infra $fe $townfe if profileab==2, cluster(pid)			outreg2 using "Tables/rob_ab", append tex(frag) bdec(3) drop(e_*  $townfe) ctitle(Prof B Rank)	label							// TABLE 7: Results using Probit (binary outcome) and ordered probit (5-pt ranking) instead of OLS. 			probit chosen elect local tax transfer kinvill buyel water health educ infra  $fe $townfe, cluster(pid)		outreg2 using "Tables/robust_probit", replace tex(frag) bdec(3) drop(e_* $townfe) ctitle(Chosen)	label		oprobit rank elect local tax transfer kinvill buyel water health educ infra  $fe, cluster(pid)		outreg2 using "Tables/robust_probit", append tex(frag) bdec(3) drop(e_* $townfe) ctitle(Rank)	label			********	APPENDIX C4: CORRUPTION SEVERITY AND POLITICAL ACTION* Open respondent-level dataset	use "respondent_level_clean.dta", clear	* Set globals for analysis: enumerator fixed effects and town fixed effects		gl fe "e_* "		gl townfe "townfe_*"		// FIGURE 4: Collapse into averages, graph figure 4, restore full dataset	preserve	collapse (mean) talkneighb* contact_official* goprotest* campaign_*, by(steal_upset)	twoway (line goprotest steal_upset) (line talkneighb steal_upset, lpattern(dash)) (line campaign_against steal_upset, lpattern(dot)) (line contact_official steal_upset, lpattern(longdash)), legend(label(1 "Go to protest") label(2 "Talk to Neighbor") label(3 "Campaign against official") label(4 "Contact gov't official")) xtitle("Upset about scandal") ytitle("Likelihood of taking action") yscale(range(1 4)) ylabel(1(1)4)	graph export "Tables/willact.pdf", as(pdf) replace	restore 		// TABLE 8: Relationship between a respondent�s evaluation of how upset they would be about a corruption scandal and the self-reported likelihood of taking part in each potential action	reg talkneighb steal_upset $fe $townfe		outreg2 using "Tables/will_act", replace tex(frag) bdec(3) drop($fe $townfe) ctitle(`x')	foreach x of varlist contact_official goprotest campaign_against {		reg `x' steal_upset  $fe $townfe		outreg2 using "Tables/will_act", append tex(frag) bdec(3) drop($fe $townfe) ctitle(`x')		}				// TABLE 9: OLS regression linking perceived corruption severity in the conjoint experiment; the degree to which citizens report being upset about a hypothetical corruption scandal; and self-report political action. 	reg steal_upset avg_rank $fe $townfe		outreg2 using "Tables/avgrank", replace tex(frag) bdec(3) drop($fe $townfe) ctitle(Steal Upset)	reg avg_action avg_rank $fe $townfe		outreg2 using "Tables/avgrank", append tex(frag) bdec(3) drop($fe $townfe) ctitle(Likelihood of Action (Avg))		********	OPEN DATASET AND SET GLOBALS FOR APPENDIX C5-C6		* Open profile-level dataset	use "profile_level_clean.dta", clear	* Set globals for analysis: enumerator fixed effects and town fixed effects		gl fe "e_* "		gl townfe "townfe_*"	********	APPENDIX C5: INTERACTION MODEL			* Define global of all interactions	global interacts "elect_* local_* tax_* transfer_* kinvill_* buyel_*"//  TABLE 10: Interaction effects	reg chosen elect local tax transfer kinvill buyel water health educ infra $interacts $fe $townfe, cluster(pid)		outreg2 using "Tables/interactions", replace side tex(frag) bdec(3) drop(e_* $townfe) ctitle(All)	label		reg rank elect local tax transfer kinvill buyel water health educ infra $interacts $fe $townfe, cluster(pid)		outreg2 using "Tables/interactions", append side tex(frag) bdec(3) drop(e_* $townfe) ctitle(Rank)	label					********	APPENDIX C6: HETEROGENEITY ANALYSIS// FIGURE 5: Results by whether thought last elections were free & fair & by party membership	** LEFT-HAND SIDE: Heterogeneity by whether thought last elections free & fair	reg chosen i.att1 i.att2 i.att4 i.att5 i.att3 $fe $townfe if freefair==1, cluster(pid)		estimate store chosen_freefair	reg chosen i.att1 i.att2 i.att4 i.att5 i.att3 $fe $townfe if freefair==0, cluster(pid)		estimate store chosen_nofreefair			coefplot (chosen_freefair, label(Elections were Free and Fair) mcolor(black) msize(large) ciopts(lcolor(black) lwidth(thin)) xlabel(-.3(.1).3) )  ///		(chosen_nofreefair, label(Elections not Free and Fair) msymbol(circle_hollow) mcolor(black) msize(large) ciopts(lcolor(black) lwidth(thin)) xlabel(-.3(.1).3)), ///		drop(_cons e_* $townfe ) omitted base xline(0)	///		headings(1.att1 = "{bf:Type of Official}" 1.att2 = "{bf:Level of Government}" 1.att3 = "{bf:Source of Funds}" 1.att4 = "{bf:How Funds Spent}" 1.att5 = "{bf:Funds Stolen From}" )  ///		ylabel(, labsize(medlarge)) xtitle("Change in Pr(Official Selected)") ytitle("") xsize(5) ysize(7) scale(.6) 	graph export "Tables/het_freefair.pdf", as(pdf) replace					** RIGHT-HAND SIDE: Heterogeneity by whether belong to any political party	reg chosen i.att1 i.att2 i.att4 i.att5 i.att3 $fe $townfe if polparty==1, cluster(pid)		estimate store chosen_partymbr	reg chosen i.att1 i.att2 i.att4 i.att5 i.att3 $fe $townfe if polparty==0, cluster(pid)		estimate store chosen_noparty		coefplot (chosen_partymbr, label(Belongs to Any Political Party) mcolor(black) msize(large) ciopts(lcolor(black) lwidth(thin)) xlabel(-.3(.1).3) )  ///		(chosen_noparty, label(Not a Party Member) msymbol(circle_hollow) mcolor(black) msize(large) ciopts(lcolor(black) lwidth(thin)) xlabel(-.3(.1).3)), ///		drop(_cons e_* $townfe ) omitted base xline(0)	///		headings(1.att1 = "{bf:Type of Official}" 1.att2 = "{bf:Level of Government}" 1.att3 = "{bf:Source of Funds}" 1.att4 = "{bf:How Funds Spent}" 1.att5 = "{bf:Funds Stolen From}" )  ///		ylabel(, labsize(medlarge)) xtitle("Change in Pr(Official Selected)") ytitle("") xsize(5) ysize(7) scale(.6) 	graph export "Tables/het_polparty.pdf", as(pdf) replace			// FIGURE 8: Heterogeneity Results by Occupation.	reg chosen i.att1 i.att2 i.att4 i.att5 i.att3 $fe $townfe if boda==1, cluster(pid)		estimate store chosen_boda	reg chosen i.att1 i.att2 i.att4 i.att5 i.att3 $fe $townfe if market==1, cluster(pid)		estimate store chosen_mkt	reg chosen i.att1 i.att2 i.att4 i.att5 i.att3 $fe $townfe if shop==1, cluster(pid)		estimate store chosen_shop			coefplot (chosen_boda, label(Motorcycle Taxi) mcolor(black) msize(large) ciopts(lcolor(black) lwidth(thin)) xlabel(-.3(.1).3) )  ///		(chosen_shop, label(Shopkeepers) msymbol(circle_hollow) mcolor(black) msize(large) ciopts(lcolor(black) lwidth(thin)) xlabel(-.3(.1).3)) ///		(chosen_mkt, label(Market vendors) msymbol(triangle_hollow) mcolor(black) msize(large) ciopts(lcolor(black) lwidth(thin)) xlabel(-.3(.1).3)), ///		drop(_cons e_* $townfe ) omitted base xline(0)	///		headings(1.att1 = "{bf:Type of Official}" 1.att2 = "{bf:Level of Government}" 1.att3 = "{bf:Source of Funds}" 1.att4 = "{bf:How Funds Spent}" 1.att5 = "{bf:Funds Stolen From}" )  ///		ylabel(, labsize(medlarge)) xtitle("Change in Pr(Official Selected)") ytitle("") xsize(5) ysize(8) scale(.6) 	graph export "Tables/het_occ.pdf", as(pdf) replace  // FIGURE 9: Heterogeneity results by whether respondent is of age 30 or higher. 	reg chosen i.att1 i.att2 i.att4 i.att5 i.att3 $fe $townfe if age<=30 & age!=., cluster(pid)		estimate store chosen_young	reg chosen i.att1 i.att2 i.att4 i.att5 i.att3 $fe $townfe if age>30 & age!=., cluster(pid)		estimate store chosen_old			coefplot (chosen_young, label(Age<30) mcolor(black) msize(large) ciopts(lcolor(black) lwidth(thin)) xlabel(-.3(.1).3) )  ///		(chosen_old, label(Age>30) msymbol(circle_hollow) mcolor(black) msize(large) ciopts(lcolor(black) lwidth(thin)) xlabel(-.3(.1).3)), ///		drop(_cons e_* $townfe ) omitted base xline(0)	///		headings(1.att1 = "{bf:Type of Official}" 1.att2 = "{bf:Level of Government}" 1.att3 = "{bf:Source of Funds}" 1.att4 = "{bf:How Funds Spent}" 1.att5 = "{bf:Funds Stolen From}" )  ///		ylabel(, labsize(medlarge)) xtitle("Change in Pr(Official Selected)") ytitle("") xsize(5) ysize(7) scale(.6) 	graph export "Tables/het_age.pdf", as(pdf) replace					// FIGURE 10: Heterogeneity Results by Gender. 	reg chosen i.att1 i.att2 i.att4 i.att5 i.att3 $fe $townfe if male==1, cluster(pid)		estimate store chosen_male	reg chosen i.att1 i.att2 i.att4 i.att5 i.att3 $fe $townfe if male==0, cluster(pid)		estimate store chosen_female		coefplot (chosen_male, label(Male) mcolor(black) msize(large) ciopts(lcolor(black) lwidth(thin)) xlabel(-.3(.1).3) )  ///		(chosen_female, label(Female) msymbol(circle_hollow) mcolor(black) msize(large) ciopts(lcolor(black) lwidth(thin)) xlabel(-.3(.1).3)), ///		drop(_cons e_* $townfe ) omitted base xline(0)	///		headings(1.att1 = "{bf:Type of Official}" 1.att2 = "{bf:Level of Government}" 1.att3 = "{bf:Source of Funds}" 1.att4 = "{bf:How Funds Spent}" 1.att5 = "{bf:Funds Stolen From}" )  ///		ylabel(, labsize(medlarge)) xtitle("Change in Pr(Official Selected)") ytitle("") xsize(5) ysize(7) scale(.6) 	graph export "Tables/het_gend.pdf", as(pdf) replace		// FIGURE 11: Heterogeneity Results by Education	reg chosen i.att1 i.att2 i.att4 i.att5 i.att3 $fe $townfe if postsec_ed==1, cluster(pid)		estimate store chosen_uni	reg chosen i.att1 i.att2 i.att4 i.att5 i.att3 $fe $townfe if postsec_ed==0, cluster(pid)		estimate store chosen_nouni			coefplot (chosen_uni, label(University or Trade School) mcolor(black) msize(large) ciopts(lcolor(black) lwidth(thin)) xlabel(-.3(.1).3) )  ///		(chosen_nouni, label(Secondary or less) msymbol(circle_hollow) mcolor(black) msize(large) ciopts(lcolor(black) lwidth(thin)) xlabel(-.3(.1).3)), ///		drop(_cons e_* $townfe ) omitted base xline(0)	///		headings(1.att1 = "{bf:Type of Official}" 1.att2 = "{bf:Level of Government}" 1.att3 = "{bf:Source of Funds}" 1.att4 = "{bf:How Funds Spent}" 1.att5 = "{bf:Funds Stolen From}" )  ///		ylabel(, labsize(medlarge)) xtitle("Change in Pr(Official Selected)") ytitle("") xsize(5) ysize(7) scale(.6) 	graph export "Tables/het_ed.pdf", as(pdf) replace						// FIGURE 12: Heterogeneity Results by Income 	reg chosen i.att1 i.att2 i.att4 i.att5 i.att3 $fe $townfe if weekly_profit<70000 & weekly_profit!=., cluster(pid)		estimate store chosen_L10	reg chosen i.att1 i.att2 i.att4 i.att5 i.att3 $fe $townfe if weekly_profit>=70000 & weekly_profit<140000 & weekly_profit!=., cluster(pid)		estimate store chosen_10_20	reg chosen i.att1 i.att2 i.att4 i.att5 i.att3 $fe $townfe if weekly_profit>=140000 & weekly_profit<210000 & weekly_profit!=., cluster(pid)		estimate store chosen_20_30	reg chosen i.att1 i.att2 i.att4 i.att5 i.att3 $fe $townfe if weekly_profit>=210000 & weekly_profit!=., cluster(pid)		estimate store chosen_G30	reg chosen i.att1 i.att2 i.att4 i.att5 i.att3 $fe $townfe if weekly_profit>=70000 & weekly_profit!=., cluster(pid)		estimate store chosen_G10			* Output for left-hand panel of figure	coefplot (chosen_L10, label(Less than 10K a Day) mcolor(black) msize(large) ciopts(lcolor(black) lwidth(thin)) xlabel(-.3(.1).3) )  ///		(chosen_10_20, label(10-20K a day) msymbol(circle_hollow) mcolor(black) msize(large) ciopts(lcolor(black) lwidth(thin)) xlabel(-.3(.1).3)), ///		drop(_cons e_* $townfe ) omitted base xline(0)	///		headings(1.att1 = "{bf:Type of Official}" 1.att2 = "{bf:Level of Government}" 1.att3 = "{bf:Source of Funds}" 1.att4 = "{bf:How Funds Spent}" 1.att5 = "{bf:Funds Stolen From}" )  ///		ylabel(, labsize(medlarge)) xtitle("Change in Pr(Official Selected)") ytitle("") xsize(5) ysize(7) scale(.6) 	graph export "Tables/het_inc1.pdf", as(pdf) replace		* Output for right-hand panel of figure	coefplot (chosen_20_30, label(20K-30K a day) msymbol(triangle_hollow) mcolor(black) msize(large) ciopts(lcolor(black) lwidth(thin)) xlabel(-.3(.1).3)) ///		(chosen_G30, label(30K+ a day) msymbol(diamond) mcolor(black) msize(large) ciopts(lcolor(black) lwidth(thin)) xlabel(-.3(.1).3)), ///		drop(_cons e_* $townfe ) omitted base xline(0)	///		headings(1.att1 = "{bf:Type of Official}" 1.att2 = "{bf:Level of Government}" 1.att3 = "{bf:Source of Funds}" 1.att4 = "{bf:How Funds Spent}" 1.att5 = "{bf:Funds Stolen From}" )  ///		ylabel(, labsize(medlarge)) xtitle("Change in Pr(Official Selected)") ytitle("") xsize(5) ysize(7) scale(.6) 	graph export "Tables/het_inc2.pdf", as(pdf) replace							// FIGURE 13: Heterogeneity Results by Urban/Rural 	reg chosen i.att1 i.att2 i.att4 i.att5 i.att3 $fe $townfe if urban_dum==1, cluster(pid)		estimate store chosen_urban	reg chosen i.att1 i.att2 i.att4 i.att5 i.att3 $fe $townfe if urban_dum==0, cluster(pid)		estimate store chosen_rural		coefplot (chosen_urban, label(Urban Resident) mcolor(black) msize(large) ciopts(lcolor(black) lwidth(thin)) xlabel(-.3(.1).3) )  ///		(chosen_rural, label(Rural Resident) msymbol(circle_hollow) mcolor(black) msize(large) ciopts(lcolor(black) lwidth(thin)) xlabel(-.3(.1).3)), ///		drop(_cons e_* $townfe ) omitted base xline(0)	///		headings(1.att1 = "{bf:Type of Official}" 1.att2 = "{bf:Level of Government}" 1.att3 = "{bf:Source of Funds}" 1.att4 = "{bf:How Funds Spent}" 1.att5 = "{bf:Funds Stolen From}" )  ///		ylabel(, labsize(medlarge)) xtitle("Change in Pr(Official Selected)") ytitle("") xsize(5) ysize(7) scale(.6) 	graph export "Tables/het_urban.pdf", as(pdf) replace